home *** CD-ROM | disk | FTP | other *** search
/ Packard Bell - Internet on a CD / internet on a cd.cdr / Internet / sites / HTML_1 / multiply.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-07-16  |  969 b   |  31 lines

  1. #include <iostream.h>
  2. #include <stdlib.h>
  3. #include "./cgi.h"
  4.  
  5. cgi_main(cgi_info *ci)
  6.  { 
  7.   int ad,bd,rd,c;
  8.   form_entry *params = NULL;
  9.   params = get_form_entries(ci);
  10.  
  11.   print_mimeheader("text/html");
  12.   if (params != NULL)
  13.        { ad = atoi(parmval(params,"a"));
  14.          bd = atoi(parmval(params,"b"));
  15.      rd = atoi(parmval(params,"round"));
  16.          c = ((ad * bd)/rd) * rd;
  17.      cout << "<html>" << parmval(params,"a") <<
  18.                  " times " << parmval(params,"b") << " = " << c <<
  19.              "</html>";
  20.          return 1;}
  21.   else { cout << "<html> Please type in the two numbers which " <<
  22.          "you want to multiply.<p>" <<
  23.          "<form method=""post"" action=""/cgi-bin/nik/multiply"">" <<
  24.              "<input name=""a""><p><input name=""b""><p>" <<
  25.              "Round down to <SELECT name=""round""><OPTION SELECTED> 1" <<
  26.              "<OPTION> 10 <OPTION> 100 </SELECT><p>" <<
  27.                  "<input type=""submit""></form></html>";
  28.          return 1;}
  29.          }
  30.  
  31.